import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import '../src/styles/style.css'
import '../src/styles/index.scss'
Vue.use(ElementUI)

router.beforeEach((to, from, next) => {
  let token = localStorage.getItem('myToken')
  if (token || to.path == "/test") { next() } else {
    if (to.path !== "/login") {
      next({ path: "/login" })
    } else {
      next()
    }
  }
})
Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
